package com.yuan;

import com.yuan.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.List;

public class SpringDemo {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        User user = (User) context.getBean("user");
        user.setAge(18);
        user.setName("XiaoMi");
        context.close();
        System.out.println(user);

        //User user1 = (User) context.getBean("user1");
        //user1.setAge(17);
        //user1.setName("DaHua");
        //System.out.println(user1);
        //
        //List<User> list = new ArrayList<>();
        //list.add(user);
        //list.add(user1);
        //list.forEach(System.out::println);
    }
}
